home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
X11
/
xsw
/
update_d.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-09
|
82KB
|
2,790 lines
/*
* @(#) update_d.c 11.2 94/02/08 SCOINC
*/
/***************************************************************************
*
* Copyright (c) 1990-1993 The Santa Cruz Operation, Inc.
*
* All rights reserved. No part of this program or publication may be
* reproduced, transmitted, transcribed, stored in a retrieval system,
* or translated into any language or computer language, in any form or
* by any means, electronic, mechanical, magnetic, optical, chemical,
* biological, or otherwise, without the prior written permission of:
*
* The Santa Cruz Operation , Inc. (408) 425-7222
* 400 Encinal St., Santa Cruz, California 95060 USA
*
**************************************************************************/
/*
* Modification History
*
* S004, 08-Feb-94, rickra
* Moved some stuff from xsw.c to here...
*
* S003, 24-Oct-93, rickra
* Added 32v5 streams stuff.
*
* S002, 16-Sep-93, rickra
* Added disk space stuff.
* Fixed some little bugs....
*
* S001, 01-June-93, rickra
* Removed a printf for debugging...
*
* S000, 27-May-93, rickra
* Initial check in. Had to shrink file name so that it
* would work with new SCCS interface!!!!
*
*/
/*+-------------------------------------------------------------------------
update_d.c - XSW CPU and wait percentage scale handler
Defined functions:
--------------------------------------------------------------------------*/
#include "include/unixincs.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/IntrinsicP.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/StringDefs.h>
#include <X11/CoreP.h>
#include <Xm/Xm.h>
#include "include/buttons.h"
#include "include/resources.h"
#include "include/xswboth.h"
#include "include/scales.h"
#include "include/xsw.h"
extern struct NetworkXswStruct *current_server;
extern struct NetworkXswStruct *input_callback_current_server;
extern struct NetworkXswStruct *toggle_button_current_server;
extern Widget TOGGLE_BUTTONS_WIDGETS[Max_state_buttons];
extern int ps_procs_to_display;
extern int got_key_event;
extern int inCommandLineOptionParse;
int current_Y_offset;
#define delta_msec(t,t0) ((( t.time * 1000L) + t.millitm) - \
((t0.time * 1000L) + t0.millitm))
/*================================================================== INT ===
* save_last_reading
*
* Called when the user specifies -help on the command line.
*
* Parameters:
* o server_pointer (I) - Pointer to the server to save last readings.
*
* Algorithm:
* Use memcpy to save specific data structures.
*
* Notes:
*
*---------------------------------------------------------------------------
*/
void
save_last_reading (server_pointer)
struct NetworkXswStruct *server_pointer;
{
(void) memcpy ((char *) server_pointer -> my_sysinfo_last, (char *) server_pointer -> my_sysinfo,
sizeof (struct sysinfo));
(void) memcpy ((char *) server_pointer -> my_minfo_last, (char *) server_pointer -> my_minfo,
sizeof (struct minfo));
(void) memcpy ((char *) server_pointer -> old_floppy_disk_stats, (char *) server_pointer -> floppy_disk_stats,
sizeof (server_pointer -> floppy_disk_stats));
(void) memcpy ((char *) server_pointer -> old_Sdsk_stats, (char *) server_pointer -> Sdsk_stats,
sizeof (server_pointer -> Sdsk_stats));
(void) memcpy ((char *) server_pointer -> old_Stp_stats, (char *) server_pointer -> Stp_stats,
sizeof (server_pointer -> Stp_stats));
(void) memcpy ((char *) server_pointer -> old_Srom_stats, (char *) server_pointer -> Srom_stats,
sizeof (server_pointer -> Srom_stats));
(void) memcpy ((char *) server_pointer -> old_esdi_disk_stats, (char *) server_pointer -> esdi_disk_stats,
sizeof (server_pointer -> esdi_disk_stats));
(void) memcpy ((char *) server_pointer -> old_wd_disk_stats, (char *) server_pointer -> wd_disk_stats,
sizeof (server_pointer -> wd_disk_stats));
(void) memcpy ((char *) server_pointer -> old_cart_tape_stats, (char *) server_pointer -> cart_tape_stats,
sizeof (server_pointer -> cart_tape_stats));
} /* End of save_last_reading */
/*================================================================== INT ===
* calc_cpu_avg(per_state) - add per_state array to avg array
*
* Add per_state to cpu_avg.
*
* Algorithm:
*
* Notes:
*
*---------------------------------------------------------------------------
*/
void
calc_cpu_avg (per_state)
time_t per_state[];
{
register itmp;
if (!current_server -> cpu_avg_init)
{
for (itmp = 0; itmp < CPU_AVG_MAX; itmp++)
(void) memcpy (current_server -> cpu_avg[itmp], per_state, sizeof (time_t) * 5);
current_server -> cpu_avg_init = 1;
}
else
{
for (itmp = 0; itmp < CPU_AVG_MAX - 1; itmp++)
(void) memcpy (current_server -> cpu_avg[itmp], current_server -> cpu_avg[itmp + 1], sizeof (time_t) * 5);
(void) memcpy (current_server -> cpu_avg[itmp], per_state, sizeof (time_t) * 5);
}
} /* end of calc_cpu_avg */
/*================================================================== INT ===
* calc_cpu_avg(per_state) - add per_state array to avg array
*
* Add per_state to cpu_avg.
*
* Parameters:
* o cpu_ticks (I) - cpu times
* o period (I) -
*
* Algorithm:
*
* Notes:
*
*---------------------------------------------------------------------------
*/
void
get_cpu_avg (cpu_ticks, period)
time_t cpu_ticks[];
int period;
{
register iperiod = CPU_AVG_MAX;
register istate;
register count = period;
for (istate = 0; istate < 5; istate++)
{
current_server -> cpu_ticks[istate] = 0;
}
while (count--)
{
iperiod--;
for (istate = 0; istate < 5; istate++)
current_server -> cpu_ticks[istate] += (current_server -> cpu_avg[iperiod])[istate];
}
for (istate = 0; istate < 5; istate++)
{
current_server -> cpu_ticks[istate] /= period;
}
} /* end of get_cpu_avg */
/*+-------------------------------------------------------------------------
calc_wait_avg(per_state) - add per_state array to avg array
--------------------------------------------------------------------------*/
void
calc_wait_avg (per_state)
time_t per_state[];
{
register itmp;
if (!current_server -> wait_avg_init)
{
for (itmp = 0; itmp < WAIT_AVG_MAX; itmp++)
(void) memcpy (current_server -> wait_avg[itmp], per_state, sizeof (time_t) * 3);
current_server -> wait_avg_init = 1;
}
else
{
for (itmp = 0; itmp < WAIT_AVG_MAX - 1; itmp++)
(void) memcpy (current_server -> wait_avg[itmp], current_server -> wait_avg[itmp + 1], sizeof (time_t) * 3);
(void) memcpy (current_server -> wait_avg[itmp], per_state, sizeof (time_t) * 3);
}
} /* end of calc_wait_avg */
/*+-------------------------------------------------------------------------
get_wait_avg(wait_ticks,period)
--------------------------------------------------------------------------*/
void
get_wait_avg (wait_ticks, period)
time_t wait_ticks[];
int period;
{
register iperiod = WAIT_AVG_MAX;
register istate;
register count = period;
for (istate = 0; istate < 3; istate++)
current_server -> wait_ticks[istate] = 0;
while (count--)
{
iperiod--;
for (istate = 0; istate < 3; istate++)
{
current_server -> wait_ticks[istate] += (current_server -> wait_avg[iperiod])[istate];
}
}
for (istate = 0; istate < 3; istate++)
current_server -> wait_ticks[istate] /= period;
} /* end of get_wait_avg */
/*+-------------------------------------------------------------------------
draw_lower_main_statics(Y_offset)
--------------------------------------------------------------------------*/
void
draw_lower_main_statics (SP)
struct NetworkXswStruct *SP;
{
int Y_offset = 0;
int last_var_y_offset = 0;
int last_bootinfo_y_offset = 0;
int last_tune_y_offset = 0;
int max = 0;
#ifdef DEBUG1
fprintf (stdout, "in draw_lower_main_statics\n");
#endif
last_var_y_offset = draw_Var (SP, Var_TLX, Y_offset);
last_bootinfo_y_offset = draw_Bootinfo (SP, Bootinfo_TLX, Y_offset);
if (last_var_y_offset > last_bootinfo_y_offset)
max = last_var_y_offset;
else
max = last_bootinfo_y_offset;
last_tune_y_offset = draw_Tune (SP, Tune_TLX, Y_offset);
if (last_tune_y_offset > max)
max = last_tune_y_offset;
/*
max = (6 + SP -> my_bootinfo -> memavailcnt +
SP -> my_bootinfo -> memusedcnt ) * FHEIGHT;
*/
draw_MiscVBT (SP, 0, max);
#ifdef DEBUG1
fprintf (stdout, "leaving draw_lower_main_statics\n");
#endif
} /* end of draw_lower_main_statics */
/*+-------------------------------------------------------------------------
update_screen()
--------------------------------------------------------------------------*/
void
update_screen (sep_window, data_updated)
Window sep_window;
int data_updated;
{
register i = 0;
time_t total_ticks;
int itmp;
static int first_cpu_call = 1;
static int first_wait_call = 1;
/*
The only time sep_window should be > 0, is if we are called from an
expose callback.
*/
/*
*/
if (sep_window > 0)
{
/*
Get cpu_ticks
*/
for (itmp = 0; itmp < 5; itmp++)
{
if (itmp != CPU_WAIT)
current_server -> cpu_ticks[itmp] = sysidelta (cpu[itmp]);
}
current_server -> cpu_ticks[CPU_WAIT] = 0;
for (itmp = 0; itmp < 3; itmp++)
current_server -> cpu_ticks[CPU_WAIT] += (current_server -> wait_ticks[itmp] = sysidelta (wait[itmp]));
}
update_Users (current_server);
if (sep_window > 0)
{
if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window)
{
total_ticks = update_CpuScale (current_server,
0,
(FHEIGHT * 1),
current_server -> cpu_ticks);
/*
Get cpu_ticks, DO NOT RECALCULATE averages, unless it is the first time
thru here. If it is the first time thru here, lets averge so that we
inititialize the average data structures. Remember, if we are in
this part of the code, it is only a refresh of the window...
*/
if (first_cpu_call)
{
calc_cpu_avg (current_server -> cpu_ticks);
first_cpu_call = 0;
}
get_cpu_avg (current_server -> cpu_ticks, 5);
total_ticks = update_CpuScale (current_server,
0,
(FHEIGHT * 2),
current_server -> cpu_ticks);
get_cpu_avg (current_server -> cpu_ticks, 10);
total_ticks = update_CpuScale (current_server,
0,
(FHEIGHT * 3),
current_server -> cpu_ticks);
/*
* Should now update the window with the pixmap....
*/
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window)
{
total_ticks = current_server -> cpu_ticks[CPU_IDLE] + current_server -> cpu_ticks[CPU_WAIT] +
current_server -> cpu_ticks[CPU_SXBRK] + current_server -> cpu_ticks[CPU_KERNEL] +
current_server -> cpu_ticks[CPU_USER];
update_WaitScale (current_server, 0, (FHEIGHT * 1), total_ticks);
/*
Get wait_ticks, DO NOT RECALCULATE averages, unless it is the first time
thru here. If it is the first time thru here, lets averge so that we
inititialize the average data structures. Remember, if we are in
this part of the code, it is only a refresh of the window...
*/
if (first_wait_call)
{
calc_wait_avg (current_server -> wait_ticks);
first_wait_call = 0;
}
get_cpu_avg (current_server -> cpu_ticks, 5);
total_ticks = current_server -> cpu_ticks[CPU_IDLE] + current_server -> cpu_ticks[CPU_WAIT] +
current_server -> cpu_ticks[CPU_SXBRK] + current_server -> cpu_ticks[CPU_KERNEL] +
current_server -> cpu_ticks[CPU_USER];
get_wait_avg (current_server -> wait_ticks, 5);
update_WaitScale (current_server, 0, (FHEIGHT * 2), total_ticks);
get_cpu_avg (current_server -> cpu_ticks, 10);
total_ticks = current_server -> cpu_ticks[CPU_IDLE] + current_server -> cpu_ticks[CPU_WAIT] +
current_server -> cpu_ticks[CPU_SXBRK] + current_server -> cpu_ticks[CPU_KERNEL] +
current_server -> cpu_ticks[CPU_USER];
get_wait_avg (current_server -> wait_ticks, 10);
update_WaitScale (current_server, 0, (FHEIGHT * 3), total_ticks);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].window)
{
update_MemScale (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].window)
{
update_FilesScale (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window)
{
update_CacheScale (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].window)
{
update_streams (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].window)
{
update_dev_stats (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].gc,
0,
0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].window)
{
update_disk_space (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].gc,
0,
0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].draw_height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].window)
{
update_Sysinfo (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].window)
{
update_nfsstat (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].window)
{
current_server -> DISPLAY_LIST[current_server -> current_items - 1].Y_length =
FHEIGHT * current_server -> COMMAND_LIST[BUTTON_ps_cpu].Y_mult;
update_ps_cpu (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].window)
{
current_server -> DISPLAY_LIST[current_server ->
current_items - 1].Y_length =
FHEIGHT * current_server -> COMMAND_LIST[BUTTON_ps_io].Y_mult;
update_ps_io (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].window)
{
current_server -> DISPLAY_LIST[current_server -> current_items - 1].Y_length =
FHEIGHT * current_server -> COMMAND_LIST[BUTTON_ps_mem].Y_mult;
update_ps_mem (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height,
0, 0);
}
}
else
while (i < current_server -> current_items)
{
switch (current_server -> DISPLAY_LIST[i].button_num)
{
case BUTTON_cpu:
for (itmp = 0; itmp < 5; itmp++)
{
if (itmp != CPU_WAIT)
current_server -> cpu_ticks[itmp] = sysidelta (cpu[itmp]);
}
/*
fprintf(stdout,"Total ticks = %ld\n",
sysidelta (cpu[CPU_IDLE]) +
sysidelta (cpu[CPU_USER]) +
sysidelta (cpu[CPU_KERNEL]) +
sysidelta (cpu[CPU_WAIT]) +
sysidelta (cpu[CPU_SXBRK]));
fprintf(stdout,"Total cum ticks = %ld\n",
current_server -> my_sysinfo->cpu[CPU_USER] +
current_server -> my_sysinfo->cpu[CPU_KERNEL] +
current_server -> my_sysinfo->cpu[CPU_SXBRK]);
fprintf(stdout,"Total CPU ticks = %ld\n",sysidelta (cpu[CPU_USER]) +
sysidelta (cpu[CPU_KERNEL]) +
sysidelta (cpu[CPU_SXBRK]));
*/
current_server -> cpu_ticks[CPU_WAIT] = 0;
for (itmp = 0; itmp < 3; itmp++)
current_server -> cpu_ticks[CPU_WAIT] += (current_server -> wait_ticks[itmp] = sysidelta (wait[itmp]));
total_ticks = update_CpuScale (current_server,
0,
(FHEIGHT * 1),
current_server -> cpu_ticks);
if (data_updated)
calc_cpu_avg (current_server -> cpu_ticks);
get_cpu_avg (current_server -> cpu_ticks, 5);
total_ticks = update_CpuScale (current_server,
0,
(FHEIGHT * 2),
current_server -> cpu_ticks);
get_cpu_avg (current_server -> cpu_ticks, 10);
total_ticks = update_CpuScale (current_server,
0,
(FHEIGHT * 3),
current_server -> cpu_ticks);
/*
* Should now update the window with the pixmap......
*/
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].height,
0, 0);
break;
case BUTTON_wait:
for (itmp = 0; itmp < 5; itmp++)
{
if (itmp != CPU_WAIT)
current_server -> cpu_ticks[itmp] = sysidelta (cpu[itmp]);
}
current_server -> cpu_ticks[CPU_WAIT] = 0;
for (itmp = 0; itmp < 3; itmp++)
current_server -> cpu_ticks[CPU_WAIT] += (current_server -> wait_ticks[itmp] = sysidelta (wait[itmp]));
total_ticks = current_server -> cpu_ticks[CPU_IDLE] + current_server -> cpu_ticks[CPU_WAIT] +
current_server -> cpu_ticks[CPU_SXBRK] + current_server -> cpu_ticks[CPU_KERNEL] +
current_server -> cpu_ticks[CPU_USER];
update_WaitScale (current_server, 0, (FHEIGHT * 1), total_ticks);
get_cpu_avg (current_server -> cpu_ticks, 5);
total_ticks = current_server -> cpu_ticks[CPU_IDLE] + current_server -> cpu_ticks[CPU_WAIT] +
current_server -> cpu_ticks[CPU_SXBRK] + current_server -> cpu_ticks[CPU_KERNEL] +
current_server -> cpu_ticks[CPU_USER];
if (data_updated)
calc_wait_avg (current_server -> wait_ticks);
get_wait_avg (current_server -> wait_ticks, 5);
update_WaitScale (current_server, 0, (FHEIGHT * 2), total_ticks);
get_cpu_avg (current_server -> cpu_ticks, 10);
total_ticks = current_server -> cpu_ticks[CPU_IDLE] + current_server -> cpu_ticks[CPU_WAIT] +
current_server -> cpu_ticks[CPU_SXBRK] + current_server -> cpu_ticks[CPU_KERNEL] +
current_server -> cpu_ticks[CPU_USER];
get_wait_avg (current_server -> wait_ticks, 10);
update_WaitScale (current_server, 0, (FHEIGHT * 3), total_ticks);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].height,
0, 0);
break;
case BUTTON_mem:
update_MemScale (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].height,
0, 0);
break;
case BUTTON_other:
update_FilesScale (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].height,
0, 0);
break;
case BUTTON_cache:
update_CacheScale (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].height,
0, 0);
break;
case BUTTON_streams:
update_streams (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].height,
0, 0);
break;
case BUTTON_dev_stats:
update_dev_stats (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].gc,
0,
0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].height,
0, 0);
break;
case BUTTON_disk_space:
update_disk_space (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].gc,
0,
0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].draw_height,
0, 0);
break;
case BUTTON_sysinfo:
update_Sysinfo (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].height,
0, 0);
break;
case BUTTON_nfsstat:
update_nfsstat (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].height,
0, 0);
break;
case BUTTON_tune_var:
draw_lower_main_statics (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].height,
0, 0);
break;
case BUTTON_ps_mem:
current_server -> DISPLAY_LIST[current_server -> current_items - 1].Y_length =
FHEIGHT * current_server -> COMMAND_LIST[BUTTON_ps_mem].Y_mult;
update_ps_mem (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height,
0, 0);
break;
case BUTTON_ps_cpu:
current_server -> DISPLAY_LIST[current_server -> current_items - 1].Y_length =
FHEIGHT * current_server -> COMMAND_LIST[BUTTON_ps_cpu].Y_mult;
update_ps_cpu (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[current_server -> DISPLAY_LIST[i].button_num].display,
current_server -> SEPERATE_WINDOWS_LIST[current_server -> DISPLAY_LIST[i].button_num].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[current_server -> DISPLAY_LIST[i].button_num].window,
current_server -> SEPERATE_WINDOWS_LIST[current_server -> DISPLAY_LIST[i].button_num].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[current_server -> DISPLAY_LIST[i].button_num].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[current_server -> DISPLAY_LIST[i].button_num].draw_height,
0, 0);
break;
case BUTTON_ps_io:
current_server -> DISPLAY_LIST[current_server ->
current_items - 1].Y_length =
FHEIGHT * current_server -> COMMAND_LIST[BUTTON_ps_io].Y_mult;
update_ps_io (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height,
0, 0);
break;
}
i++;
}
/*
fprintf(stdout,"leaving update_screen\n");
*/
} /* End of update_screen */
/*+-------------------------------------------------------------------------
update_display(read_new_kernel_data,sep_window)
--------------------------------------------------------------------------*/
void
update_display (read_new_kernel_data, sep_window)
int read_new_kernel_data;
Window sep_window;
{
int i, j;
int temp = 2;
int boot_height = 0;
Arg args[32];
int argcount;
/*
fprintf(stdout,"in update_display\n");
*/
save_last_reading (current_server);
(void) ftime (¤t_server -> timeb_info_read);
current_server -> StatPeriod_msec =
delta_msec (current_server -> timeb_info_read,
current_server -> timeb_last_info_read);
current_server -> timeb_last_info_read = current_server -> timeb_info_read;
if (sep_window > 0)
{
if (sep_window == window)
{
/*
THIS SHOULD NEVER HAPPEN HOW!!!! DEAD CODE!!!????
*/
xsw_write (current_server,
current_server -> FileDescriptor,
send_user_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> user_data_pointer,
sizeof (int));
}
/* In ODT Gecko, The var table has dynamic structures now.... */
xsw_write (current_server,
current_server -> FileDescriptor,
send_var_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_v,
sizeof (struct var));
xsw_write (current_server,
current_server -> FileDescriptor,
send_bootstring_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> bootstring,
sizeof (current_server -> bootstring)
);
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> configuration_string_size,
sizeof (current_server -> configuration_string_size)
);
/*
for (j = 0 ; j < 1024; j++ )
if ( new_server-> configuration_string[j] == 10 )
boot_height++;
boot_height += current_server my_bootinfo -> memavailcnt +
current_server -> my_bootinfo -> memusedcn + 11);
Need to check to see if we are really canging size.....!!!
change_and_update_window_sizes (current_server,
BUTTON_tune_var,
boot_height);
*/
if (current_server -> configuration_string != NULL)
free (current_server -> configuration_string);
current_server -> configuration_string = (char *)
calloc (1, current_server -> configuration_string_size);
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> configuration_string,
current_server -> configuration_string_size
);
if ((sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].window) ||
(sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window) ||
(sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window) ||
(sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].window) ||
(sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window))
{
/*
* Get freemem data....
*/
xsw_write (current_server,
current_server -> FileDescriptor,
send_freemem_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_freemem,
sizeof (int));
/*
* Get availsmem data....
*/
xsw_write (current_server,
current_server -> FileDescriptor,
send_availsmem_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_availsmem,
sizeof (int));
/*
* Get maxmem data....
*/
xsw_write (current_server,
current_server -> FileDescriptor,
send_maxmem_data, sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_maxmem,
sizeof (int));
/*
* Get sysinfo data....
*/
xsw_write (current_server,
current_server -> FileDescriptor,
send_sysinfo_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_sysinfo,
sizeof (struct sysinfo));
/*
* Get minfo data....
*/
xsw_write (current_server,
current_server -> FileDescriptor,
send_minfo_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_minfo,
sizeof (struct minfo));
current_server -> cummulative_memory_used +=
*current_server -> my_freemem;
current_server -> cummulative_swap_used +=
current_server -> my_minfo -> freeswap *
NBPSCTR / 1024;
current_server -> cummulative_avail_swap +=
*current_server -> my_availsmem * NBPP / 1024;
current_server -> memory_sample_count++;
}
if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].window)
{
current_server -> cur_device_displayed = 0;
if (current_server -> got_floppy_disk_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_floppy_disk_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> floppy_disk_stats,
sizeof (current_server -> floppy_disk_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> floppy_disk_stats,
current_server -> old_floppy_disk_stats);
}
if (current_server -> got_scsi_disk_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_scsi_disk_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> Sdsk_stats,
sizeof (current_server -> Sdsk_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> Sdsk_stats,
current_server -> old_Sdsk_stats);
}
if (current_server -> got_scsi_tape_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_scsi_tape_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> Stp_stats,
sizeof (current_server -> Stp_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> Stp_stats,
current_server -> old_Stp_stats);
}
if (current_server -> got_scsi_rom_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_scsi_rom_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> Srom_stats,
sizeof (current_server -> Srom_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> Srom_stats,
current_server -> old_Srom_stats);
}
if (current_server -> got_esdi_disk_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_esdi_disk_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> esdi_disk_stats,
sizeof (current_server -> esdi_disk_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> esdi_disk_stats,
current_server -> old_esdi_disk_stats);
}
if (current_server -> got_wd_disk_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_wd_disk_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> wd_disk_stats,
sizeof (current_server -> wd_disk_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> wd_disk_stats,
current_server -> old_wd_disk_stats);
}
if (current_server -> got_cart_tape_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_cart_tape_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> cart_tape_stats,
sizeof (current_server -> cart_tape_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> cart_tape_stats,
current_server -> old_cart_tape_stats);
}
if (current_server -> cur_device_displayed > current_server -> max_device_displayed)
{
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].Y_mult = current_server -> cur_device_displayed + 1;
change_and_update_window_sizes (current_server,
BUTTON_dev_stats,
current_server -> cur_device_displayed + 1);
current_server -> max_device_displayed =
current_server -> cur_device_displayed;
}
}
if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].window)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_disk_space_data,
sizeof (int));
/*
* Save current data
*/
if (current_server -> current_disk_space_bak != NULL)
free (current_server -> current_disk_space_bak);
current_server -> current_disk_space_bak =
current_server -> current_disk_space;
current_server -> current_disk_space_entries_bak =
current_server -> current_disk_space_entries;
/*
* Read new data
*/
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> current_disk_space_entries,
sizeof (int));
current_server -> current_disk_space =
(struct disk_space_struct *)
malloc (current_server -> current_disk_space_entries *
sizeof (struct disk_space_struct));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> current_disk_space,
current_server -> current_disk_space_entries *
sizeof (struct disk_space_struct));
/*
if (current_server -> current_disk_space_entries >
current_server -> max_disk_space_entries)
{
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].Y_mult =
current_server -> current_disk_space_entries + 1;
current_server -> max_disk_space_entries =
current_server -> current_disk_space_entries;
change_and_update_window_sizes (
current_server,
BUTTON_disk_space,
current_server -> current_disk_space_entries + 1);
}
*/
}
if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].window)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_files_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> file_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_inodes_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> inode_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_procs_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> proc_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_regions_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> region_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_cblocks_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> myclist,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_call_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> callout_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_mount_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> mount_count,
sizeof (int));
}
if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].window)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_streams_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> mystreams,
sizeof (struct strstat));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> mynmblock,
sizeof (int));
if ( current_server -> os_version == 1 )
{
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> pagest,
sizeof (struct pagestat));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> Rbsize,
15 * sizeof(uint));
}
else
if ( current_server -> os_version == 0 )
{
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> rbsize,
9 * sizeof(ushort));
}
}
if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].window)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_nfs_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> rcstat,
sizeof (current_server -> rcstat));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> rsstat,
sizeof (current_server -> rsstat));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> clstat,
sizeof (current_server -> clstat));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> svstat,
sizeof (current_server -> svstat));
}
if (
((sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].window) ||
(sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].window) ||
(sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].window)))
{
(void) memcpy ((char *) current_server -> oldprocs,
(char *) current_server -> procs,
current_server -> slots_in_use *
sizeof (struct my_proc_struct));
current_server -> noldprocs = current_server -> nprocs;
(void) memcpy ((char *) current_server -> poldprocs,
(char *) current_server -> pprocs,
current_server -> noldprocs *
sizeof (struct my_proc_struct *));
grok_proc (current_server);
if (sep_window ==
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].window)
{
if (current_server -> max_slots_in_use >
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height / FHEIGHT)
{
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_width =
DisplayWidth (display, screen);
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height =
(FHEIGHT * current_server -> max_slots_in_use) +
(FHEIGHT * 10);
XFreePixmap (
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].display,
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].pixmap);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].pixmap =
XCreatePixmap (
XtDisplay (current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].DrawAreaW),
RootWindowOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].DrawAreaW)),
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height,
DefaultDepthOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].DrawAreaW)));
argcount = 0;
XtSetArg (args[argcount], XmNheight, (XtArgVal) current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height);
argcount++;
XtSetValues (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].DrawAreaW,
args, argcount);
}
}
if (sep_window ==
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].window)
{
if (current_server -> max_slots_in_use >
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height / FHEIGHT)
{
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_width =
DisplayWidth (display, screen);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height =
(FHEIGHT * current_server -> max_slots_in_use) +
(FHEIGHT * 10);
XFreePixmap (
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].display,
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].pixmap);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].pixmap =
XCreatePixmap (
XtDisplay (current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].DrawAreaW),
RootWindowOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].DrawAreaW)),
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height,
DefaultDepthOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].DrawAreaW)));
argcount = 0;
XtSetArg (args[argcount], XmNheight, (XtArgVal) current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height);
argcount++;
XtSetValues (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].DrawAreaW,
args, argcount);
}
}
if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].window)
{
read_memory_stats (current_server);
/*
* Adjust screen height if neccessary....
*/
if (current_server -> current_mem_procs >
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height / FHEIGHT)
{
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_width =
DisplayWidth (display, screen);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height =
(FHEIGHT * current_server -> current_mem_procs) +
(FHEIGHT * 10);
XFreePixmap (
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].display,
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].pixmap);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].pixmap =
XCreatePixmap (
XtDisplay (current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].DrawAreaW),
RootWindowOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].DrawAreaW)),
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height,
DefaultDepthOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].DrawAreaW)));
argcount = 0;
XtSetArg (args[argcount], XmNheight, (XtArgVal) current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height);
argcount++;
XtSetValues (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].DrawAreaW,
args, argcount);
}
}
}
}
else
{
/*
(void) ftime (&timeb_info_read);
StatPeriod_msec = delta_msec (timeb_info_read, timeb_last_info_read);
timeb_last_info_read = timeb_info_read;
*/
xsw_write (current_server,
current_server -> FileDescriptor,
send_user_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> user_data_pointer,
sizeof (int));
/* In ODT Gecko , The var table has dynamic structures now.... */
xsw_write (current_server,
current_server -> FileDescriptor,
send_var_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_v,
sizeof (struct var));
if ((current_server -> COMMAND_LIST[BUTTON_sysinfo].on == 1) ||
(current_server -> COMMAND_LIST[BUTTON_cpu].on == 1) ||
(current_server -> COMMAND_LIST[BUTTON_wait].on == 1) ||
(current_server -> COMMAND_LIST[BUTTON_mem].on == 1) ||
(current_server -> COMMAND_LIST[BUTTON_cache].on == 1))
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_freemem_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_freemem,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_availsmem_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_availsmem,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_maxmem_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_maxmem,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_sysinfo_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_sysinfo,
sizeof (struct sysinfo));
xsw_write (current_server,
current_server -> FileDescriptor,
send_minfo_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> my_minfo,
sizeof (struct minfo));
current_server -> cummulative_memory_used +=
*current_server -> my_freemem;
current_server -> cummulative_swap_used +=
current_server -> my_minfo -> freeswap *
NBPSCTR / 1024;
current_server -> cummulative_avail_swap +=
*current_server -> my_availsmem * NBPP / 1024;
current_server -> memory_sample_count++;
}
if (current_server -> COMMAND_LIST[BUTTON_dev_stats].on == 1)
{
current_server -> cur_device_displayed = 0;
if (current_server -> got_floppy_disk_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_floppy_disk_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> floppy_disk_stats,
sizeof (current_server -> floppy_disk_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> floppy_disk_stats,
current_server -> old_floppy_disk_stats);
}
if (current_server -> got_scsi_disk_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_scsi_disk_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> Sdsk_stats,
sizeof (current_server -> Sdsk_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> Sdsk_stats,
current_server -> old_Sdsk_stats);
}
if (current_server -> got_scsi_tape_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_scsi_tape_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> Stp_stats,
sizeof (current_server -> Stp_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> Stp_stats,
current_server -> old_Stp_stats);
}
if (current_server -> got_scsi_rom_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_scsi_rom_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> Srom_stats,
sizeof (current_server -> Srom_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> Srom_stats,
current_server -> old_Srom_stats);
}
if (current_server -> got_esdi_disk_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_esdi_disk_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> esdi_disk_stats,
sizeof (current_server -> esdi_disk_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> esdi_disk_stats,
current_server -> old_esdi_disk_stats);
}
if (current_server -> got_wd_disk_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_wd_disk_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> wd_disk_stats,
sizeof (current_server -> wd_disk_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> wd_disk_stats,
current_server -> old_wd_disk_stats);
}
if (current_server -> got_cart_tape_stats)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_cart_tape_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> cart_tape_stats,
sizeof (current_server -> cart_tape_stats));
current_server -> cur_device_displayed +=
count_active_devices (current_server -> cart_tape_stats,
current_server -> old_cart_tape_stats);
}
if (current_server -> cur_device_displayed > current_server -> max_device_displayed)
{
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].Y_mult = current_server -> cur_device_displayed + 1;
change_and_update_window_sizes (current_server,
BUTTON_dev_stats,
current_server -> cur_device_displayed + 1);
current_server -> max_device_displayed = current_server -> cur_device_displayed;
}
}
if (current_server -> COMMAND_LIST[BUTTON_other].on == 1)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_files_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> file_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_inodes_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> inode_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_procs_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> proc_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_regions_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> region_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_cblocks_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> myclist,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_call_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> callout_count,
sizeof (int));
xsw_write (current_server,
current_server -> FileDescriptor,
send_mount_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> mount_count,
sizeof (int));
}
if (current_server -> COMMAND_LIST[BUTTON_streams].on == 1)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_streams_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> mystreams,
sizeof (struct strstat));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> mynmblock,
sizeof (int));
if ( current_server -> os_version == 1 )
{
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> pagest,
sizeof (struct pagestat));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> Rbsize,
15 * sizeof(uint));
}
else
if ( current_server -> os_version == 0 )
{
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> rbsize,
9 * sizeof(ushort));
}
}
if (current_server -> COMMAND_LIST[BUTTON_disk_space].on == 1)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_disk_space_data,
sizeof (int));
/*
* Save current data
*/
if (current_server -> current_disk_space_bak != NULL)
free (current_server -> current_disk_space_bak);
current_server -> current_disk_space_bak =
current_server -> current_disk_space;
current_server -> current_disk_space_entries_bak =
current_server -> current_disk_space_entries;
/*
* Read new data
*/
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> current_disk_space_entries,
sizeof (int));
current_server -> current_disk_space =
(struct disk_space_struct *)
malloc (current_server -> current_disk_space_entries *
sizeof (struct disk_space_struct));
xsw_read (current_server,
current_server -> FileDescriptor,
current_server -> current_disk_space,
current_server -> current_disk_space_entries *
sizeof (struct disk_space_struct));
/*
if (current_server -> current_disk_space_entries >
current_server -> max_disk_space_entries)
{
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_disk_space].Y_mult =
current_server -> current_disk_space_entries + 1;
current_server -> max_disk_space_entries =
current_server -> current_disk_space_entries;
change_and_update_window_sizes (
current_server,
BUTTON_disk_space,
current_server -> current_disk_space_entries + 1);
}
*/
}
if (current_server -> COMMAND_LIST[BUTTON_nfsstat].on == 1)
{
xsw_write (current_server,
current_server -> FileDescriptor,
send_nfs_data,
sizeof (int));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> rcstat,
sizeof (current_server -> rcstat));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> rsstat,
sizeof (current_server -> rsstat));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> clstat,
sizeof (current_server -> clstat));
xsw_read (current_server,
current_server -> FileDescriptor,
¤t_server -> svstat,
sizeof (current_server -> svstat));
}
if (((current_server -> COMMAND_LIST[BUTTON_ps_cpu].on == 1) ||
(current_server -> COMMAND_LIST[BUTTON_ps_io].on == 1)))
{
(void) memcpy ((char *) current_server -> oldprocs,
(char *) current_server -> procs,
current_server -> slots_in_use *
sizeof (struct my_proc_struct));
current_server -> noldprocs = current_server -> nprocs;
(void) memcpy ((char *) current_server -> poldprocs,
(char *) current_server -> pprocs,
current_server -> noldprocs *
sizeof (struct my_proc_struct *));
grok_proc (current_server);
/*
* Determine if we need to increase the size of the drawing area......
*/
if (current_server -> COMMAND_LIST[BUTTON_ps_cpu].on == 1)
{
if (current_server -> max_slots_in_use >
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height / FHEIGHT)
{
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_width =
DisplayWidth (display, screen);
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height =
(FHEIGHT * current_server -> max_slots_in_use) +
(FHEIGHT * 10);
XFreePixmap (
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].display,
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].pixmap);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].pixmap =
XCreatePixmap (
XtDisplay (current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].DrawAreaW),
RootWindowOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].DrawAreaW)),
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height,
DefaultDepthOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].DrawAreaW)));
argcount = 0;
XtSetArg (args[argcount], XmNheight, (XtArgVal) current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].draw_height);
argcount++;
XtSetValues (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_cpu].DrawAreaW,
args, argcount);
}
}
if (current_server -> COMMAND_LIST[BUTTON_ps_io].on == 1)
{
if (current_server -> max_slots_in_use >
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height / FHEIGHT)
{
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_width =
DisplayWidth (display, screen);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height =
(FHEIGHT * current_server -> max_slots_in_use) +
(FHEIGHT * 10);
XFreePixmap (
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].display,
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].pixmap);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].pixmap =
XCreatePixmap (
XtDisplay (current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].DrawAreaW),
RootWindowOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].DrawAreaW)),
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height,
DefaultDepthOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].DrawAreaW)));
argcount = 0;
XtSetArg (args[argcount], XmNheight, (XtArgVal) current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_io].draw_height);
argcount++;
XtSetValues (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_io].DrawAreaW,
args, argcount);
}
}
}
if (current_server -> COMMAND_LIST[BUTTON_ps_mem].on == 1)
{
read_memory_stats (current_server);
/*
* Adjust screen height if neccessary....
*/
if (current_server -> current_mem_procs >
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height / FHEIGHT)
{
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_width =
DisplayWidth (display, screen);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height =
(FHEIGHT * current_server -> current_mem_procs) +
(FHEIGHT * 10);
XFreePixmap (
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].display,
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].pixmap);
current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].pixmap =
XCreatePixmap (
XtDisplay (current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].DrawAreaW),
RootWindowOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].DrawAreaW)),
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height,
DefaultDepthOfScreen (
XtScreen (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].DrawAreaW)));
argcount = 0;
XtSetArg (args[argcount], XmNheight, (XtArgVal) current_server ->
SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].draw_height);
argcount++;
XtSetValues (current_server -> SEPERATE_WINDOWS_LIST[BUTTON_ps_mem].DrawAreaW,
args, argcount);
}
}
}
if (current_server -> connected)
{
update_StatPeriod (current_server);
update_StatCycle (current_server);
update_Users (current_server);
update_screen (sep_window, 1);
redrawing_entire_DrawArea = 0;
}
/*
fprintf(stdout,"leaving update_display\n");
*/
} /* end of update_display */
/*+-------------------------------------------------------------------------
set_display_mode(new_mode)
--------------------------------------------------------------------------*/
void
set_display_mode (new_mode)
int new_mode;
{
void set_update_timer (unsigned long, struct NetworkXswStruct *);
int i = 0;
int turn_off = 0;
int position;
int Y_remove;
int need_to_realize = 0;
Arg args[32];
int argcount;
XWindowAttributes DrawAreaXYWH_bak;
XSizeHints *my_size_hints;
/* Determine if button is already on. If so, set turn_off flag */
while ((turn_off == 0) && (i < current_server -> current_items))
{
if (current_server -> DISPLAY_LIST[i].button_num == new_mode)
{
turn_off = 1;
position = i;
}
i++;
}
if (turn_off == 1)
{
if (new_mode > Max_sub_menu_buttons)
fprintf (stdout, "INTERNAL error\n");
/*
Turn of button
*/
current_server -> TOGGLE_BUTTONS_STATE[new_mode] = 0;
if (got_key_event)
{
if (input_callback_current_server == current_server)
{
argcount = 0;
XtSetArg (args[argcount], XmNset, False);
argcount++;
XtSetValues (TOGGLE_BUTTONS_WIDGETS[new_mode], args, argcount);
}
}
else if (toggle_button_current_server == current_server)
{
argcount = 0;
XtSetArg (args[argcount], XmNset, False);
argcount++;
XtSetValues (TOGGLE_BUTTONS_WIDGETS[new_mode], args, argcount);
}
current_server -> SEPERATE_WINDOWS_LIST[new_mode].x =
current_server -> SEPERATE_WINDOWS_LIST[new_mode].shell_widget -> core.x,
current_server -> SEPERATE_WINDOWS_LIST[new_mode].y =
current_server -> SEPERATE_WINDOWS_LIST[new_mode].shell_widget -> core.y;
/*
SEPERATE_WINDOWS_LIST[new_mode].already_created = 0;
fprintf (stdout,"In set_display_mode, setting already_created = 0\n");
*/
XtPopdown (current_server -> SEPERATE_WINDOWS_LIST[new_mode].shell_widget);
XClearArea (display, window, 0, current_server -> DISPLAY_LIST[position].Y_offset,
DrawAreaXYWH.width,
DrawAreaXYWH.height - current_server -> DISPLAY_LIST[position].Y_offset,
0);
i = position;
Y_remove = current_server -> DISPLAY_LIST[i].Y_length;
while ((position < (Max_state_buttons - 1)) &&
(i < current_server -> current_items))
{
current_server -> DISPLAY_LIST[i].button_num = current_server -> DISPLAY_LIST[i + 1].button_num;
current_server -> DISPLAY_LIST[i].Y_offset = current_server -> DISPLAY_LIST[i + 1].Y_offset -
Y_remove;
/* for BUTTON_ps_cpu, the lenght will change. but for all others, it will not */
current_server -> DISPLAY_LIST[i].Y_length = current_server -> DISPLAY_LIST[i + 1].Y_length;
i++;
}
current_server -> current_items--;
current_server -> COMMAND_LIST[new_mode].on = 0;
current_Y_offset = current_Y_offset -
(FHEIGHT * current_server -> COMMAND_LIST[new_mode].Y_mult);
}
else
{
if ((new_mode == BUTTON_nfsstat) && (current_server -> nfs_available == 0))
{
display_network_msg (current_server, "NFS is not configured into the kernel");
argcount = 0;
XtSetArg (args[argcount], XmNset, False);
argcount++;
XtSetValues (TOGGLE_BUTTONS_WIDGETS[BUTTON_nfsstat], args,
argcount);
/*
disp_msg (colorDisplayMsg.pixel, "NFS is not configured into the kernel");
*/
/*
Since we are using MOTIF menu manager, we need to override the button press
activation done when the button is pressed using the mouse....
*/
return;
}
if (new_mode > Max_sub_menu_buttons)
fprintf (stdout, "INTERNAL error\n");
/*
Turn on the button
*/
current_server -> TOGGLE_BUTTONS_STATE[new_mode] = 1;
if (got_key_event)
{
if (input_callback_current_server == current_server)
{
argcount = 0;
XtSetArg (args[argcount], XmNset, True);
argcount++;
XtSetValues (TOGGLE_BUTTONS_WIDGETS[new_mode], args, argcount);
}
}
else if (toggle_button_current_server == current_server)
{
argcount = 0;
XtSetArg (args[argcount], XmNset, True);
argcount++;
XtSetValues (TOGGLE_BUTTONS_WIDGETS[new_mode], args, argcount);
}
else if (inCommandLineOptionParse)
{
argcount = 0;
XtSetArg (args[argcount], XmNset, True);
argcount++;
XtSetValues (TOGGLE_BUTTONS_WIDGETS[new_mode], args, argcount);
}
if (current_server -> SEPERATE_WINDOWS_LIST[new_mode].already_created == 1)
{
need_to_realize = 1;
}
else
create_seperate_windows_widgets (new_mode);
current_server -> current_items++;
current_server -> DISPLAY_LIST[current_server -> current_items - 1].button_num = new_mode;
current_server -> DISPLAY_LIST[current_server -> current_items - 1].Y_offset = current_Y_offset;
if ((new_mode == BUTTON_ps_cpu) || (new_mode == BUTTON_ps_mem) ||
(new_mode == BUTTON_ps_io))
{
current_server -> COMMAND_LIST[new_mode].Y_mult = /* (FHEIGHT * 7) - */
(DisplayHeight (display, screen) - current_Y_offset) / FHEIGHT;
}
current_server -> DISPLAY_LIST[current_server -> current_items - 1].Y_length =
FHEIGHT * current_server -> COMMAND_LIST[new_mode].Y_mult;
current_Y_offset = current_Y_offset +
(FHEIGHT * current_server -> COMMAND_LIST[new_mode].Y_mult);
current_server -> COMMAND_LIST[new_mode].on = 1;
DrawAreaXYWH_bak = DrawAreaXYWH;
if (need_to_realize == 1)
{
argcount = 0;
XtSetArg (args[argcount], XmNx, current_server -> SEPERATE_WINDOWS_LIST[new_mode].x - 11);
argcount++;
XtSetArg (args[argcount], XmNy, current_server -> SEPERATE_WINDOWS_LIST[new_mode].y - 27);
argcount++;
XtSetValues (current_server -> SEPERATE_WINDOWS_LIST[new_mode].shell_widget,
args, argcount);
/*
my_size_hints = XAllocSizeHints ();
my_size_hints -> x = SEPERATE_WINDOWS_LIST[new_mode].x - 11;
my_size_hints -> y = SEPERATE_WINDOWS_LIST[new_mode].y - 27;
XSetWMSizeHints (SEPERATE_WINDOWS_LIST[new_mode].display,
SEPERATE_WINDOWS_LIST[new_mode].window,
my_size_hints, USPosition);
XSetWMSizeHints (SEPERATE_WINDOWS_LIST[new_mode].display,
SEPERATE_WINDOWS_LIST[new_mode].window,
my_size_hints, PPosition);
*/
XtPopup (current_server -> SEPERATE_WINDOWS_LIST[new_mode].shell_widget, XtGrabNone);
/*
XtMoveWidget (SEPERATE_WINDOWS_LIST[new_mode].shell_widget,
SEPERATE_WINDOWS_LIST[new_mode].x - 11,
SEPERATE_WINDOWS_LIST[new_mode].y - 27);
*/
}
}
/*
XtRemoveTimeOut (timer_id);
set_update_timer (current_server -> StatCycle_msec);
*/
/*
fprintf (stdout, "leaving set_display_mode\n");
*/
} /* end of set_display_mode */
/*+-------------------------------------------------------------------------
draw_display(initial)
--------------------------------------------------------------------------*/
void
draw_display (initial, sep_window)
int initial;
Window sep_window;
{
register int i = 0;
/*
If we have seperate windows and the main window needs updating, OR,
If we are not seperate windows
*/
if (sep_window > 0)
{
if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window)
{
draw_CpuScale_literals (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window)
{
draw_WaitScale_literals (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].window)
draw_OtherScale_literals (current_server);
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].window)
{
draw_MemScale_literals (current_server);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window)
{
draw_CacheScale_literals (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_streams].window)
draw_streams_literals (current_server);
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_nfsstat].window)
draw_nfsstat_literals (current_server);
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_sysinfo].window)
draw_Sysinfo_literals (current_server);
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].window)
{
draw_lower_main_statics (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].height,
0, 0);
}
else if (sep_window == current_server -> SEPERATE_WINDOWS_LIST[BUTTON_dev_stats].window)
draw_dev_stats_literals (current_server);
}
else
while (i < current_server -> current_items)
{
switch (current_server -> DISPLAY_LIST[i].button_num)
{
case BUTTON_cpu:
draw_CpuScale_literals (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].height,
0, 0);
break;
case BUTTON_wait:
draw_WaitScale_literals (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].height,
0, 0);
break;
case BUTTON_other:
draw_OtherScale_literals (current_server);
break;
case BUTTON_mem:
draw_MemScale_literals (current_server);
break;
case BUTTON_cache:
draw_CacheScale_literals (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].height,
0, 0);
break;
case BUTTON_streams:
draw_streams_literals (current_server);
break;
case BUTTON_nfsstat:
draw_nfsstat_literals (current_server);
break;
case BUTTON_sysinfo:
draw_Sysinfo_literals (current_server);
break;
case BUTTON_tune_var:
draw_lower_main_statics (current_server);
XCopyArea (
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].display,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].pixmap,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].window,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].gc, 0, 0,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].width,
current_server -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].height,
0, 0);
break;
case BUTTON_dev_stats:
draw_dev_stats_literals (current_server);
break;
case BUTTON_disk_space:
break;
} /* End of case statement */
i++;
} /* End of while loop */
} /* end of draw_display */
/* end of update_and_draw.c */